﻿<script type="text/javascript">
<!--
function add_cart(id_deal){
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
											  document.getElementById('count_cart').innerHTML=xmlhttp.responseText;
											  alert("Đã thêm vào giỏ hàng");						 
										  }
									  }
	xmlhttp.open("GET","<?php echo base_url("home/add_cart")?>?id_deal="+id_deal,true);
	xmlhttp.send();
	
}
//-->
</script>
<div class="section1" style="margin-top: -25px;">
    <h2 class="tt_spnb">Sản phẩm nổi bật</h2>
    <div class="slide_spnb" style="height: 335px !important;">
      <div class="slider" style="cursor: pointer !important;">
       <?php foreach ($list_deal_top_100 as $value){	?>
        <div class="new_product item" id="item1">
          <div class="slide"> <a href="<?=base_url('deal_detail?did='.$value['id'])?>"><img src="<?php echo base_url($value['large_image']); ?>" width="633" height="100%" alt="<?php echo ($value['large_image']); ?>" /></a> </div>
          <div class="info">
            <h2><a href="<?=base_url('deal_detail?did='.$value['id'])?>"><?=$value['name']?></a></h2>
            
            <p class="pt"><?php if($value['delivery']==0) echo 'Giao sản phẩm'; if($value['delivery']==1) echo 'Giao voucher'; ?></p>
            
            <p><?=$value['title']?></p>
            <p class="n_price"><?=number_format($value['price_sale_off'])?>đ</p>
            <a href="<?=base_url('deal_detail?did='.$value['id'])?>" class="n_view">Xem</a>
            <div class="orginal_price">
              <p class="or_price">Giá gốc: <span><?=number_format($value['price'])?>đ</span></p>
              <p class="percent">Giảm: <span><?=$value['sale_off']?>%</span></p>
            </div>
          </div>
        </div>
      
     <?php }?>
      </div>
      <!--end slider -->
      <div class = 'prevButton'></div>
      <div class = 'nextButton'></div>
    </div>
    <!-- end slide spnb --> 
  </div>
  <!-- end section1 -->
  
  <div class="section_list">
    <h2 class="title2">Sản phẩm bán chạy nhất <a href="<?=base_url('list_deal_top_seller')?>">Xem tất cả >></a></h2>
    <div class="iosSlider">
      <ul class="list-product clear_mar">
       <?php foreach ($list_deal_top_seller as $value){	?>
        <li class="artile">
        	<a href="<?=base_url('deal_detail?did='.$value['id'])?>">
          <div class="cover-image" style="background-image:url(<?php echo base_url($value['small_image']); ?>)">
          <img src="<?php echo base_url($value['small_image']); ?>" width="281" height="281" alt="d" />
          </div>
          <h2><?=$value['name']?></h2>
          </a>
          <div class="article_info"> <a onclick="add_cart(<?=$value['id']?>)" style="cursor: pointer;" class="giohang" title="Thêm vào giỏ hàng"></a>
            <p class="art_price"><?=number_format($value['price_sale_off'])?>đ<span ><?php if($value['freeship']==1) echo 'Free Ship'; ?></span></p>
            <p class="view_person"><?=$value['count']?> người đã mua</p>
            <a href="<?=base_url('deal_detail?did='.$value['id'])?>" class="view_pro">Xem</a> </div>
          <div class="orginal_price orginal_price2">
            <p class="or_price">Giá gốc: <span><?=number_format($value['price'])?>đ</span></p>
            <p class="percent">Giảm: <span><?=$value['sale_off']?>%</span></p>
          </div>
        </li>
        <?php }?>
      </ul>
      <div class = 'next'></div>
      <div class = 'prev unselectable'></div>
    </div>
  </div>
  <!-- end section_list -->
  
  
  <div class="section_list">
    <h2 class="title2">Sản phẩm khác <a href="<?=base_url('list_deal')?>">Xem tất cả >></a></h2>
    <ul class="list-product">
    	<?php foreach ($list_deal as $value){	?>
      <li class="artile">
      	<a href="<?=base_url('deal_detail?did='.$value['id'])?>">
        	<div class="cover-image" style="background-image:url(<?php echo base_url($value['small_image']); ?>)"><img src="<?php echo base_url($value['large_image']); ?>" width="281" height="281" alt="d" /></div>
        	<h2><?=$value['name']?></h2>
        </a>
        <div class="article_info"> <a onclick="add_cart(<?=$value['id']?>)" style="cursor: pointer;"  class="giohang" title="Thêm vào giỏ hàng"></a>
          <p class="art_price"><?=number_format($value['price_sale_off'])?>đ<span ><?php if($value['freeship']==1) echo 'Free Ship'; ?></span></p>
            <p class="view_person"><?=$value['count']?> người đã mua</p>
          <a href="<?=base_url('deal_detail?did='.$value['id'])?>" class="view_pro">Xem</a> </div>
        <div class="orginal_price orginal_price2">
          <p class="or_price">Giá gốc: <span><?=number_format($value['price'])?>đ</span></p>
            <p class="percent">Giảm: <span><?=$value['sale_off']?>%</span></p>
        </div>
      </li>
      <?php }?>
    </ul>
     <!-- <p class="view_more"><a href="#">Xem thêm</a></p>  -->
  </div>
  <!-- end section_list --> 